]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
[InfoBar] Allow to optionally change the button label
authorFlorian Müllner <fmuellner@src.gnome.org>
Wed, 10 Mar 2010 14:14:56 +0000 (15:14 +0100)
committerFlorian Müllner <fmuellner@src.gnome.org>
Thu, 18 Mar 2010 00:43:13 +0000 (01:43 +0100)
Currently the infoBar's button will always read "Undo" - sometimes
a different label makes more sense, so allow to optionally set the
label to something else.

https://bugzilla.gnome.org/show_bug.cgi?id=612200

js/ui/overview.js

index cf3b574bc5973215a205511c7b8b8b54be91de9d..070d6766e8899c1c4778f3e8a49279509590882e 100644 (file)
@@ -89,8 +89,7 @@ InfoBar.prototype = {
                                   x_fill: true,
                                   y_fill: false });
         this._label = new St.Label();
-        this._undo = new St.Button({ label: _("Undo"),
-                                     style_class: 'info-bar-link-button' });
+        this._undo = new St.Button({ style_class: 'info-bar-link-button' });
 
         let bin = new St.Bin({ x_fill: false,
                                y_fill: false,
@@ -153,7 +152,7 @@ InfoBar.prototype = {
             this._overviewWasHidden = true;
     },
 
-    setMessage: function(text, undoCallback) {
+    setMessage: function(text, undoCallback, undoLabel) {
         if (this._timeoutId)
             Mainloop.source_remove(this._timeoutId);
 
@@ -177,6 +176,11 @@ InfoBar.prototype = {
 
         this._timeoutId = Mainloop.timeout_add_seconds(INFO_BAR_HIDE_TIMEOUT, Lang.bind(this, this._onTimeout));
 
+        if (undoLabel)
+            this._undo.label = undoLabel;
+        else
+            this._undo.label = _("Undo");
+
         this._undoCallback = undoCallback;
         if (undoCallback)
             this._undo.show();